/**
 * 岗位接口
 */

const Router = require("koa-router");
const router = new Router();
const { SystemPostController } = require("../controller/sys_post.js");
const auth = require("../middleware/auth.js");
const dataScope = require("../middleware/dataScope.js");
const passport = require("koa-passport");

router.get(
  "/v1/system/post/list",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:query"),
  dataScope,
  SystemPostController.sysPostList
);
router.get(
  "/v1/system/post/all",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:query"),
  dataScope,
  SystemPostController.sysAllPostList
);
router.post(
  "/v1/system/post/add",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:add"),
  SystemPostController.sysPostAdd
);
router.post(
  "/v1/system/post/delete",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:remove"),
  SystemPostController.sysPostDel
);
router.post(
  "/v1/system/post/deleteByIds",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:remove"),
  SystemPostController.sysPostDelByIds
);
router.put(
  "/v1/system/post/update",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:edit"),
  SystemPostController.sysPostUpd
);
router.get(
  "/v1/system/post/getById",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:query"),
  SystemPostController.sysPostById
);

router.post(
  "/v1/system/post/export",
  passport.authenticate("jwt", { session: false }),
  auth("system:post:export"),
  SystemPostController.sysPostExport
);

module.exports = router;
